package ro.upt.dcda.pricezone.common;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class ConnectionFactory {

	private static SessionFactory factory;

	@SuppressWarnings("deprecation")
	public static synchronized SessionFactory getFactory() {
		if (factory == null) {
			try {
				factory = new Configuration().configure().buildSessionFactory();
			} catch (Throwable ex) {
				System.err.println("Failed to create sessionFactory object."
						+ ex);
				throw new ExceptionInInitializerError(ex);
			}
		}
		return factory;
	}
}
